define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {

    var Controller = {
        index: function () {
            $(document).on("click", ".btn-jiansuo", function () {
                var selecttime = $(".selecttime").val();
                // if (!selecttime) {
                //     Toastr.error('时间不能为空');
                // }

                $.ajax({
                    dataType: 'json',
                    type: 'POST',
                    url: 'statistics/selecttime',
                    data: {selecttime:selecttime},
                    success: function (data) {
                        console.log(data);
                        if (data.code == 0) {
                            Toastr.error(data.msg);
                        } else {
                            
                                var storecount = data.list.storecount ? data.list.storecount : "0";
                                var storecount1 = data.list.storecount1 ? data.list.storecount1 : "0";
                                var carcount = data.list.carcount ? data.list.carcount : "0";
                                var carcount1 = data.list.carcount1 ? data.list.carcount1 : "0";
                                var productcount = data.list.productcount ? data.list.productcount : "0";
                                var productcount1 = data.list.productcount1 ? data.list.productcount1 : "0";
                                var violationcount = data.list.violationcount ? data.list.violationcount : "0";
                                var violationcount1 = data.list.violationcount1 ? data.list.violationcount1 : "0";
                                $("#storecount").html(storecount);
                                $("#storecount1").html(storecount1);
                                $("#carcount").html(carcount);
                                $("#carcount1").html(carcount1);
                                $("#productcount").html(productcount);
                                $("#productcount1").html(productcount1);
                                $("#violationcount").html(violationcount);
                                $("#violationcount1").html(violationcount1);
                            

                        }
                    },
                    error: function (jqXHR, textStatus, errorThrown) {

                    }
                });


            });

            Form.api.bindevent($('.lrtj'));
            Controller.api.bindevent();
        },
        api: {
            bindevent: function () {
                Form.api.bindevent($("form[role=form]"));
            }
        }
    };
    return Controller;
});

